package com.headfirst.decorator.version1;

/**
 * 浓缩咖啡,是一种具体的饮料,继承了抽象的饮料类Beverage
 * @author sunhongguang
 * @create 2022-01-22-20:44
 */
public class Espresso extends Beverage {
    public Espresso() {
        super.setDescription(super.getSize()+" Espresso");
    }

    public Espresso(String size) {
        super.setSize(size);
        super.setDescription(size+" Espresso");
    }

    @Override
    public double cost() {
        double price = 0;
        switch (super.getSize()){
            case "小杯":
                price = 1.99;
                break;
            case "中杯":
                price = 2.19;
                break;
            case "大杯":
                price = 2.39;
                break;
            case "超大杯":
                price = 2.59;
                break;
        }
        return price;
    }
}
